﻿using SIG.Model;
using SIG.Model.Enums;
using SIG.Model.Identity;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIG.Data.UnitOfWork
{
    public  class InitialMemorySet
    {
        #region Fields

        /// <summary>The _addresses.</summary>
        private List<Log> _logs;

      

        /// <summary>The _categories.</summary>
        private List<Category> _categories;

        /// <summary>The _menus.</summary>
        private List<Menu> _menus;
        //private List<DepartmentAggregate> _departmentAggregates;

        ///// <summary>The _equipment aggregate.</summary>
        //private List<EquipmentAggregate> _equipmentAggregate;

        ///// <summary>The _logins.</summary>
        //private List<Login> _logins;

        ///// <summary>The _organizations.</summary>
        //private List<Organization> _organizations;

        ///// <summary>The _positions.</summary>
        //private List<Position> _positions;

        /// <summary>The _roles.</summary>
        private List<Role> _roles;

        /// <summary>The _users.</summary>
        private List<User> _users;

        #endregion

        //#region Public Properties

        /// <summary>Gets the logs.</summary>
        public List<Log> Logs
        {
            get
            {
                if (this._logs == null)
                {
                    this._logs = new List<Log>()
                                          {
                                              new Log()
                                                  {                                                     
                                                      Date = DateTime.ParseExact("1981/03/14", "yyyy/M/d", (IFormatProvider)CultureInfo.InvariantCulture),
                                                      Level = "INFO",
                                                      Logger = "Log4Net.Logger",
                                                      Message = "test",
                                                      Exception = "test",
                                                      Thread = "test" ,UserName = "Admin"                                                     
                                                  }
                                          };
                }

                return this._logs;
            }
        }

   

        /// <summary>Gets the menus.</summary>
        public List<Menu> Menus
        {
            get
            {
                if (this._menus == null)
                {
                    this._menus = new List<Menu>()
                                          {
                                              new Menu()
                                                  {
                                                    Title = "控制台",
                                                    //ControllerName = "Home",
                                                    //ActionName = "Index",
                                                    //AreaName = "Admin",
                                                    Url = "/Admin/Home/Index",
                                                    Category = this.Categories[0],                                                  
                                                    Importance = 100,
                                                    CreatedDate = DateTime.Now,
                                                    CreatedBy = "admin"                                                     
                                                  },
                                               new Menu()
                                                  {
                                                    Title = "首页",
                                                    //ControllerName = "Home",
                                                    //ActionName = "Index",
                                                    //AreaName = "",
                                                    Url = "/Home/Index",
                                                    Category = this.Categories[1],                                                 
                                                    Importance = 100,
                                                    CreatedDate = DateTime.Now,
                                                    CreatedBy = "admin"
                                                  },
                                          };
                }

                return this._menus;
            }
        }

        /// <summary>Gets the categories.</summary>
        public List<Category> Categories
        {
            get
            {
                if (this._categories == null)
                {
                    this._categories = new List<Category>()
                                            {
                                                new Category() { Title = "后台菜单", Importance = 0,  CreatedBy="admin",CreatedDate = DateTime.Now, Active = true, ModelType = ModelType.MENU, IsSys=true },
                                                new Category() { Title = "前台主菜单", Importance = 0,  CreatedBy="admin",CreatedDate = DateTime.Now, Active = true, ModelType = ModelType.MENU, IsSys=true },
                                                new Category() { Title = "新闻资讯", Importance = 0,  CreatedBy="admin",CreatedDate = DateTime.Now, Active = true, ModelType = ModelType.ARTICLE , IsSys=false},
                                                new Category() { Title = "电子设置", Importance = 0,  CreatedBy="admin",CreatedDate = DateTime.Now, Active = true, ModelType = ModelType.PRODUCT, IsSys=false}                                               
                                            };
                }
                return this._categories;
            }
        }


        ///// <summary>Gets the departmentAggregates.</summary>
        //public List<DepartmentAggregate> DepartmentAggregates
        //{
        //    get
        //    {
        //        if (this._departmentAggregates == null)
        //        {
        //            this._departmentAggregates = new List<DepartmentAggregate>()
        //                                    {
        //                                        new DepartmentAggregate() { Id =new Guid("62588897-8e83-cf15-3239-08d20141829a"), Name = "CARDIOLOGY", FacilityId =Guid.NewGuid(),FacilityName="Siege" },
        //                                        new DepartmentAggregate() { Id = new Guid("1d3808c7-49b0-c771-3f19-08d2014fe20b"), Name = "PAEDIATRICS", FacilityId =Guid.NewGuid(),FacilityName="Siege" },
        //                                        new DepartmentAggregate() { Id = new Guid("7360dcdf-fe3d-cb2e-f9ba-08d201500d38"), Name = "GERONTOLOGY", FacilityId =Guid.NewGuid(),FacilityName="Siege" },
        //                                        new DepartmentAggregate() { Id = new Guid("ae233b9a-fc42-c634-fe53-08d201501f2f"), Name = "EMERGENCY", FacilityId =Guid.NewGuid(),FacilityName="Siege" },
        //                                        new DepartmentAggregate() { Id = new Guid("07345d64-af9e-cd1c-72de-08d201502eaf"), Name = "Radiology", FacilityId =Guid.NewGuid(),FacilityName="Siege" },
        //                                        new DepartmentAggregate() { Id = new Guid("f192295f-7db7-c6bf-e1e2-08d201503c2f"), Name = "Test department", FacilityId =Guid.NewGuid(),FacilityName="Siege" },
        //                                    };
        //        }

        //        return this._departmentAggregates;
        //    }
        //}
        ///// <summary>Gets or sets the equipment aggregates.</summary>
        //public List<EquipmentAggregate> EquipmentAggregates
        //{
        //    get
        //    {
        //        if (this._equipmentAggregate == null)
        //        {
        //            this._equipmentAggregate = new List<EquipmentAggregate>()
        //                                           {
        //                                               new EquipmentAggregate()
        //                                                   {
        //                                                    Id = new Guid("602D9F0C-40DA-4FCE-8C4D-F22748D5FB2D"),
        //                                                    DepartmentId = new Guid("62588897-8e83-cf15-3239-08d20141829a"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "Name of equipment",
        //                                                    DepartmentName = "CARDIOLOGY",
        //                                                    Description="test"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                     Id = new Guid("3f9ed765-e3a3-c361-166a-08d20209eb80"),
        //                                                    DepartmentId =new Guid("ae233b9a-fc42-c634-fe53-08d201501f2f"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "EMERGENCY",
        //                                                    Description="other Description"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                      Id = new Guid("f568d71e-065e-c221-23f0-08d2020a154b"),
        //                                                    DepartmentId = new Guid("62588897-8e83-cf15-3239-08d20141829a"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "CARDIOLOGY",
        //                                                    Description="other Description"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                    Id = new Guid("d5fde3d3-043f-cdd5-f4d3-08d2020a2260"),
        //                                                    DepartmentId = new Guid("7360dcdf-fe3d-cb2e-f9ba-08d201500d38"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "GERONTOLOGY",
        //                                                    Description="other Description"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                     Id = new Guid("4e8124ae-8167-cccc-5185-08d2020a3313"),
        //                                                    DepartmentId = new Guid("7360dcdf-fe3d-cb2e-f9ba-08d201500d38"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "GERONTOLOGY",
        //                                                    Description="other Description"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                       Id = new Guid("cae745f7-e324-c724-9376-08d2020a3f71"),
        //                                                    DepartmentId = new Guid("62588897-8e83-cf15-3239-08d20141829a"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "CARDIOLOGY",
        //                                                    Description="other Description"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                      Id = new Guid("42039d57-a36c-c729-792f-08d2020a4e77"),
        //                                                    DepartmentId = new Guid("62588897-8e83-cf15-3239-08d20141829a"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "CARDIOLOGY",
        //                                                    Description="other Description"
        //                                                  },
        //                                                   new EquipmentAggregate()
        //                                                   {
        //                                                       Id = new Guid("588a1a6f-8a4e-c584-d83c-08d2020a6009"),
        //                                                    DepartmentId = new Guid("62588897-8e83-cf15-3239-08d20141829a"),
        //                                                    Model = "Equipment model",
        //                                                    Name = "An other equipment",
        //                                                    DepartmentName = "CARDIOLOGY",
        //                                                    Description="other Description"
        //                                                  }
        //                                           };
        //        }

        //        return this._equipmentAggregate;
        //    }

        //    set
        //    {
        //        this._equipmentAggregate = value;
        //    }
        //}

        ///// <summary>Gets or sets the logins.</summary>
        //public List<Login> Logins
        //{
        //    get
        //    {
        //        if (this._logins == null)
        //        {
        //            this._logins = new List<Login>() { new Login() { Id = Guid.NewGuid(), LoginProvider = "test", ProviderKey = "test", ProviderDisplayName = "test", } };
        //        }

        //        return this._logins;
        //    }

        //    set
        //    {
        //        this._logins = value;
        //    }
        //}

        ///// <summary>Gets the organizations.</summary>
        //public List<Organization> Organizations
        //{
        //    get
        //    {
        //        if (this._organizations == null)
        //        {
        //            this._organizations = new List<Organization>()
        //                                      {
        //                                          new Organization()
        //                                              {
        //                                                  Id = Guid.NewGuid(),
        //                                                  Name = "Siege",
        //                                                  Departments = this.Departments.Skip(0).Take(1).ToList(),
        //                                                  Address = this.Addresses[0]
        //                                              },
        //                                          new Organization()
        //                                              {
        //                                                  Id = Guid.NewGuid(),
        //                                                  Name = "Siege2",
        //                                                  Departments = this.Departments.Skip(1).Take(1).ToList(),
        //                                                  Address = this.Addresses[1]
        //                                              },
        //                                          new Organization()
        //                                              {
        //                                                  Id = Guid.NewGuid(),
        //                                                  Name = "Siege3",
        //                                                  Departments = this.Departments.Skip(2).Take(1).ToList(),
        //                                                  Address = this.Addresses[2]
        //                                              },
        //                                          new Organization()
        //                                              {
        //                                                  Id = Guid.NewGuid(),
        //                                                  Name = "Sieg4e",
        //                                                  Departments = this.Departments.Skip(3).Take(1).ToList(),
        //                                                  Address = this.Addresses[3]
        //                                              },
        //                                          new Organization()
        //                                              {
        //                                                  Id = Guid.NewGuid(),
        //                                                  Name = "Siege5",
        //                                                  Departments = this.Departments.Skip(4).Take(1).ToList(),
        //                                                  Address = this.Addresses[4]
        //                                              },
        //                                          new Organization()
        //                                              {
        //                                                  Id = Guid.NewGuid(),
        //                                                  Name = "Siege6",
        //                                                  Departments = this.Departments.Skip(5).Take(1).ToList(),
        //                                                  Address = this.Addresses[5]
        //                                              },
        //                                      };
        //        }

        //        return this._organizations;
        //    }
        //}

        ///// <summary>Gets the positions.</summary>
        //public List<Position> Positions
        //{
        //    get
        //    {
        //        if (this._positions == null)
        //        {
        //            this._positions = new List<Position>()
        //                                  {
        //                                      new Position() { Id = new Guid("5a0971d4-3205-ce80-fa51-08d1b453d5ac"), Title = "Sales Representative", },
        //                                      new Position() { Id = Guid.NewGuid(), Title = "Owner", },
        //                                      new Position() { Id = new Guid("ba9fdac0-6fdb-c65c-73fa-08d1c048b23e"), Title = "Order Administrator", },
        //                                      new Position() { Id = new Guid("ff9b26b1-8c8c-c649-318e-08d1e2d77734"), Title = "Order Administrator", },
        //                                  };
        //        }

        //        return this._positions;
        //    }
        //}

        /// <summary>Gets or sets the roles.</summary>
        public List<Role> Roles
        {
            get
            {
                if (this._roles == null)
                {
                    this._roles = new List<Role>() {
                        new Role() { RoleName = "系统管理员", Description="系统管理员",IsSys = true },                      
                        new Role() { RoleName = "用户", Description="普通用户",IsSys = true }
                    };
                }

                return this._roles;
            }

            set
            {
                this._roles = value;
            }
        }

        /// <summary>Gets or sets the users.</summary>
        public List<User> Users
        {
            get
            {
                if (this._users == null)
                {
                    this._users = new List<User>()
                                      {
                                          new User()
                                              {
                                                  Id = new Guid("448e47ad-0fc3-c5c2-584d-08d1b874916a"),
                                                  UserName = "admin",
                                                  PasswordHash = "Vfxgi4OSAxb4rBS4eEIgZoq3NlbERigJrjYaXjxZWGA=",
                                                  Gender = Gender.Male,
                                                  QQ = "13212847",
                                                  Mobile = "206) 555-9857",
                                                  RealName = "Davolio",                                              
                                                  Birthday = DateTime.ParseExact("1981/03/14", "yyyy/M/d", (IFormatProvider)CultureInfo.InvariantCulture),
                                                  Email = "aaaa@aaa.com",
                                                  PhotoUrl = "LStBf4=",
                                                  IsActive = true,
                                                  Roles = new List<Role>() { this.Roles[0] },
                                                  //Claims = new List<Claim>() { this.Claims[0] },
                                                  SecurityStamp = "w/T/8i7iLGfORnUqTxl8VcSIZ5UBTDeXkoHPxEKPoVc=",
                                                  CreateDate = DateTime.UtcNow,
                                                  LastActivityDate= DateTime.UtcNow
                                              },
                      
                                          new User()
                                              {
                                                  Id = new Guid("f3f3a7be-1a99-c4e1-c830-08d1c03f3913"),
                                                  UserName = "ytjang",
                                                  PasswordHash = "Vfxgi4OSAxb4rBS4eEIgZoq3NlbERigJrjYaXjxZWGA=",
                                                  Gender = Gender.Male,
                                                  QQ = "24214547",
                                                  Mobile = "17862518515",
                                                  RealName = "doubletong",
                                                  Birthday = DateTime.ParseExact("1981/05/14", "yyyy/M/d", (IFormatProvider)CultureInfo.InvariantCulture),
                                                  Email = "Andrew1@aaa.com",
                                                 PhotoUrl = "LStBf4=",
                                              IsActive = true,
                                                  Roles = new List<Role>() { this.Roles[1] },
                                                  
                                                  SecurityStamp = "w/T/8i7iLGfORnUqTxl8VcSIZ5UBTDeXkoHPxEKPoVc=",
                                                  CreateDate = DateTime.UtcNow,
                                                  LastActivityDate= DateTime.UtcNow
                                              },
                                      };
                }

                return this._users;
            }

            set
            {
                this._users = value;
            }
        }
    }
}
